package day1;

import java.util.HashMap;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-12-08
 * Time: 14:28
 */

//删除公共字符
//https://www.nowcoder.com/practice/f0db4c36573d459cae44ac90b90c6212?tpId=85&&tqId=2986
//8&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
public class DeletePublicCharacters {
    public static void main(String[] args) {
        //利用哈希表来解决
        //先读取两个字符串
        Scanner in = new Scanner(System.in);
        String str1 = in.nextLine();
        String str2 = in.nextLine();
        //先将第二个数组遍历到hash表中
        HashMap<Character,Integer> map = new HashMap<>();
        for (int i = 0; i < str2.length(); i++) {
            //判断表中是否包含该字符
            if (map.get(str2.charAt(i)) == null){
                //第一次插入该字符
                map.put(str2.charAt(i),1);
            }else {
                //不是第一次插入该字符
                map.put(str2.charAt(i),map.get(str2.charAt(i))+1);
            }
        }

        String ret = "";
        //在遍历第一个数组 然后和hash中比较
        for (int i = 0; i < str1.length(); i++) {
            if (map.get(str1.charAt(i)) == null){
                ret += str1.charAt(i);
            }
        }
        System.out.println(ret);
    }
}
